package com.xquant.system.api.factory;

import com.xquant.common.core.constant.HttpStatus;
import com.xquant.common.core.web.domain.AjaxResult;
import com.xquant.system.api.RemoteDailyPriceService;
import com.xquant.system.api.RemoteDurationService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.stereotype.Component;

import java.util.Collections;
import java.util.HashMap;
import java.util.Map;

/**
 * @author cloud
 * @version 1.0
 * @description:
 * @date 2022/4/21 14:33
 */
@Component
public class RemoteDurationFallbackFactory implements FallbackFactory<RemoteDurationService> {
    private static final Logger log = LoggerFactory.getLogger(RemoteDurationService.class);


    @Override
    public RemoteDurationService create(Throwable cause) {
        log.error("调用每日报送估值失败"+cause.getMessage());
        return new RemoteDurationService() {
            @Override
            public AjaxResult insertDuration(Map<String, Object> param) {
                AjaxResult ajaxResult = new AjaxResult();
                ajaxResult.put("msg","调用每日报送估值失败"+cause.getMessage());
                ajaxResult.put("code", HttpStatus.ERROR);
                return ajaxResult;
            }
        };
    }


}
